namespace LS.UGFUnits
{
    using Unity.VisualScripting;
    
    [UnitShortTitle("Set GameSpeed")]
    public sealed class SetGameSpeed: BaseUnit
    {
        [DoNotSerialize]
        public ValueInput Value { get; private set; }

        protected override void Definition()
        {
            base.Definition();
            Value =  ValueInput<float>(nameof(Value), 1);
            Requirement(Value, base.Input);
        }

        protected override ControlOutput In(Flow flow)
        {
            var value = flow.GetValue<float>(Value);
            var com = Target;
            if (com != null)
            {
                com.GameSpeed = value;
            }
            return base.In(flow);
        }
    }
}